<?php
namespace Home\Controller;

use Think\Controller;

class DatabaseController extends Controller {
	
	public function idsAction() {
		$table = I("table", "article");
		$startId = I("startId", 0);
		$endId = I("endId", 20000);
		$ids = M()->query("select id from {$table} where id between {$startId} and {$endId}");
		$uds = array();
		foreach ( $ids as $v ) {
			$uds[] = $v['id'];
		}
		echo json_encode($uds);
		exit();
	}
	
	public function exportDataAction() {
		$table = I("table", "article");
		$id = I('id', 0, "intval");
		$data = M()->query("select * from $table where id={$id}");
		echo json_encode($data);
		exit();
	}
	
}